<?php 
ini_set("memory_limit", "12M");
if(!isset($_SESSION)) 
{ 
session_start(); 
} 
unset($_SESSION['s_cameras']);
include_once '../value/value_kr.php';
include_once 'checklogin.php';

include '../connection/connection.php';
set_time_limit(0);
$searchdate = date("Y-m-d");

$listMonitor = mysql_query("select * from monitor order by Pos",$connection);
$selectallcamenra = mysql_query("SELECT cf.id,cf.`name` FROM `configcamera` cf ORDER BY name",$connection);
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<link href="../css/style.css" rel="stylesheet" type="text/css" />
 <script type="text/javascript" src="../js/jquery.js"></script>

 <link rel="stylesheet" href="../css/jquery-ui.css" />
 <script type="text/javascript" src="../js/jquery-ui.js"></script>
 <script type="text/javascript" src="../js/globalize.js"></script>
<style type="text/css">
.ui-widget-content{
	border:1px solid #4A4A4A;
}	
.ui-spinner-input{
	margin: 0px 20px 0px 4px !important;
}
.ui-spinner{
	vertical-align: top !important;
}
</style>
<script type="text/javascript">
    $(function() {
        $( "#datepickerfrom" ).datepicker({
            showOn: "button",
            buttonImage: "../images/calendar.gif",
            buttonImageOnly: true,
            dateFormat: "yy-mm-dd",
            autoSize: true
        });
        $( "#datepickerto" ).datepicker({
            showOn: "button",
            buttonImage: "../images/calendar.gif",
            buttonImageOnly: true,
            dateFormat: "yy-mm-dd",
            autoSize: true
        });
        $( "#inputfrom" ).datepicker({
            showOn: "button",
            buttonImage: "../images/calendar.gif",
            buttonImageOnly: true,
            dateFormat: "yy-mm-dd",
            autoSize: true
        });
        $( "#inputto" ).datepicker({
            showOn: "button",
            buttonImage: "../images/calendar.gif",
            buttonImageOnly: true,
            dateFormat: "yy-mm-dd",
            autoSize: true
        });
    });
    $.widget( "ui.spinnerhour", $.ui.spinner, {
        options: {
        	 min : 0,
     	    max : 23,
     	    showOn : 'both'
        },
     
        _parse: function( value ) {
          if ( typeof value === "string" ) {
            // already a timestamp
            if ( Number( value ) == value ) {
              return Number( value );
            }
            return  Globalize.parseInt( value );
          }
          return value;
        },
     
        _format: function( value ) {
          return Globalize.format( value, "d2" );
        }
      });
    
    $.widget( "ui.spinnermunite", $.ui.spinner, {
        options: {
        	 min : 0,
     	    max : 59,
     	    showOn : 'both'
        },
        _parse: function( value ) {
          if ( typeof value === "string" ) {
            // already a timestamp
            if ( Number( value ) == value ) {
              return Number( value );
            }
            return  Globalize.parseInt( value );
          }
          return value;
        },
     
        _format: function( value ) {
          return Globalize.format( value, "d2" );
        }
      });
     

    $(function() {
    	$("#s_hourfrom").spinnerhour();
    	$("#s_hourfrom").bind("keypress",function(event){
    		validateHour(this,event);
    	});
    	$("#s_hourto").spinnerhour();
    	$("#s_hourto").bind("keypress",function(event){
    		validateHour(this,event);
    	});
    	
    	$("#s_munitefrom").spinnermunite();
    	$("#s_munitefrom").bind("keypress",function(event){
    		validateMunite(this,event);
    	});
    	$("#s_secondfrom").spinnermunite();
    	$("#s_secondfrom").bind("keypress",function(event){
    		validateMunite(this,event);
    	});
    	$("#s_muniteto").spinnermunite();
    	$("#s_muniteto").bind("keypress",function(event){
    		validateMunite(this,event);
    	});
    	$("#s_secondto").spinnermunite();
    	$("#s_secondto").bind("keypress",function(event){
    		validateMunite(this,event);
    	});
    	$("#input_hourfrom").spinnerhour();
    	$("#input_hourfrom").bind("keypress",function(event){
    		validateHour(this,event);
    	});
    	$("#input_hourto").spinnerhour();
    	$("#input_hourto").bind("keypress",function(event){
    		validateHour(this,event);
    	});
    	
    	$("#input_munitefrom").spinnermunite();
    	$("#input_munitefrom").bind("keypress",function(event){
    		validateMunite(this,event);
    	});
    	$("#input_secondfrom").spinnermunite();
    	$("#input_secondfrom").bind("keypress",function(event){
    		validateMunite(this,event);
    	});
    	$("#input_muniteto").spinnermunite();
    	$("#input_muniteto").bind("keypress",function(event){
    		validateMunite(this,event);
    	});
    	$("#input_secondto").spinnermunite();
    	$("#input_secondto").bind("keypress",function(event){
    		validateMunite(this,event);
    	});
    	
    });

 // validate
    function validateHour(ele,evt)
    {
	     if(evt.keyCode!=8)
	     {
		     var theEvent = evt || window.event;
		     var key = theEvent.keyCode || theEvent.which;
		     key = String.fromCharCode( key );
		     var regex = /[0-9]/;
			
		     if( !regex.test(key) )
		    {
		       theEvent.returnValue = false;
		
		       if(theEvent.preventDefault) theEvent.preventDefault();
		
		     }else{
		    	 //theEvent.preventDefault();
		    	 OnChangeHour(key,ele);
		    	 theEvent.returnValue = false;
		    	 if(theEvent.preventDefault) theEvent.preventDefault();
		     }
	     }
    }
    
    function validateMunite(ele,evt)
    {
	     if(evt.keyCode!=8)
	     {
		     var theEvent = evt || window.event;
		     var key = theEvent.keyCode || theEvent.which;
		     key = String.fromCharCode( key );
		     var regex = /[0-9]/;
		     if( !regex.test(key) )
		    {
		       theEvent.returnValue = false;
		
		       if(theEvent.preventDefault) theEvent.preventDefault();
		
		     }else{
		    	 OnChangeMunite(key,ele);
		    	 theEvent.returnValue = false;
		    	 if(theEvent.preventDefault) theEvent.preventDefault();
		     }
	     }
    }
    
  //onchange from
 	 function OnChangeHour(key,ele){
 	  	 	var value = $(ele).val();
 	  	 	if(value.length>2){
 	  	 		if(value.slice(0,1)==0){
 	  	 			value = value.slice(1);
 	  	 		}
 	  	 	}
 	  	 if(value.length==0){value = "0"+key;}
	  	 else{
	  		value = parseInt(value)+key;
	  	 }
       	if(value < 00){
       		$(ele).val('23');
       	}else if(value > 23 ){
       		$(ele).val('00');
       	}else{
       		$(ele).val(value);
       	}
   }
    
   function OnChangeMunite(key,ele){
   		var value = $(ele).val();
  	 	if(value.length>2){
  	 		if(value.slice(0,1)==0){
  	 			value = value.slice(1);
  	 		}
  	 	}
	  	 if(value.length==0){value = "0"+key;}
	  	 else{
	  		value = parseInt(value)+key;
	  	 }
	   	if(value < 00){
	   		$(ele).val('59');
	   	}else if(value > 59 ){
	   		$(ele).val('00');
	   	}else{
	   		$(ele).val(value);
	   	}
   }

   function validateNumber(evt, ele)
   {
	    var fail = $("#re_fail").val();
		var ok = $("#re_ok_h").val();
	     if(evt.keyCode!=8)
	     {
		     var theEvent = evt || window.event;
		     var key = theEvent.keyCode || theEvent.which;
		     key = String.fromCharCode( key );
		     var regex = /[0-9]/;
		     if( !regex.test(key) )
		    {
		       	theEvent.returnValue = false;
		       	if(theEvent.preventDefault) theEvent.preventDefault();
		
		     }else if(parseInt(fail+key)>parseInt(ok)){
		    		theEvent.returnValue = false;
			       	if(theEvent.preventDefault) theEvent.preventDefault();
			}
	     }
   }

</script>
    
<script type="text/javascript">
$(document).ready(function(){
	ScrollTable();
	
});
function MyResize(){
	ScrollTable();
}

function ScrollTable(){
	wid = $("table#tablebody").parent().css('width');
	wid = wid.slice(0,-2)-18;
	$("table#tablebody").css("width", wid);
	$("table#tableheader").css("width", wid);
	$('table#tablebody').parent().scrollTop(0);
	OnTRCSS();
}

function OnTRCSS(){
	$("table.tbchung tr:even").each(function(){
		$(this).css("background-color","#eff3fa");
	});
}

</script>
<script type="text/javascript">
function OnSearch(){
	var winHf = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
	temp = $("#divscroll").position();
	var winH = parseInt(winHf - temp.top - 15);
	var m_fromdate = $('#datepickerfrom').val();
	var l_from = "";
	if ($('#s_hourfrom').val() != "" && isNaN($('#s_hourfrom').val())== false){
		l_from = $('#s_hourfrom').val();
	}else{
		l_from = "00";
	}
	if ($('#s_munitefrom').val() != "" && isNaN($('#s_munitefrom').val())== false){
		l_from += ":"+$('#s_munitefrom').val();	
	}else{
		l_from += ":00";
	}
	if ($('#s_secondfrom').val() != "" && isNaN($('#s_secondfrom').val())== false){
		l_from += ":"+$('#s_secondfrom').val();	
	}else{
		l_from += ":00";
	}
	var m_todate = $('#datepickerto').val();
	var l_to = "";
	if ($('#s_hourto').val() != "" && isNaN($('#s_hourto').val())== false){
		l_to = $('#s_hourto').val();
	}else{
		l_to = "00";
	}
	if ($('#s_muniteto').val() != "" && isNaN($('#s_muniteto').val())== false){
		l_to += ":"+$('#s_muniteto').val();	
	}else{
		l_to += ":00";
	}
	if ($('#s_secondto').val() != "" && isNaN($('#s_secondto').val())== false){
		l_to += ":"+$('#s_secondto').val();	
	}else{
		l_to += ":00";
	}
	var s_monitor = "";
	if ($("#selectall").is(":checked")){
		s_monitor = "0";
	}else{
		s_monitor = $('#s_monitor').val();
	}
	m_fromdate = m_fromdate+" "+l_from;
	m_todate = m_todate+" "+l_to;
	if (m_fromdate!==""){
		$('body').css('cursor',"wait");
		$.ajax({url:"ajax_recognize_list.php", data:{ m_fromdate:m_fromdate , m_todate:m_todate, s_monitor:s_monitor,winH:winH} , success:function(result){
			var expr = new RegExp('>[ \t\r\n\v\f]*<', 'g');
			var response_html_fixed = result.replace(expr, '><');
			$('body').css('cursor','auto');
			$("#tablebody tr").remove();
			$("#tablebody tbody").html(response_html_fixed);
			ScrollTable();
			
		}});
	}
}

function OnSave(){
	var winHf = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
	temp = $("#divscroll").position();
	var winH = parseInt(winHf - temp.top - 15);
	$("#winH").val(winH);
	var m_fromdate = $('#inputfrom').val();
	var l_from = "";
	if ($('#input_hourfrom').val() != "" && isNaN($('#input_hourfrom').val())== false){
		l_from = $('#input_hourfrom').val();
	}else{
		l_from = "00";
	}
	if ($('#input_munitefrom').val() != "" && isNaN($('#input_munitefrom').val())== false){
		l_from += ":"+$('#input_munitefrom').val();	
	}else{
		l_from += ":00";
	}
	if ($('#input_secondfrom').val() != "" && isNaN($('#input_secondfrom').val())== false){
		l_from += ":"+$('#input_secondfrom').val();	
	}else{
		l_from += ":00";
	}
	var m_todate = $('#inputto').val();
	var l_to = "";
	if ($('#input_hourto').val() != "" && isNaN($('#input_hourto').val())== false){
		l_to = $('#input_hourto').val();
	}else{
		l_to = "00";
	}
	if ($('#input_muniteto').val() != "" && isNaN($('#input_muniteto').val())== false){
		l_to += ":"+$('#input_muniteto').val();	
	}else{
		l_to += ":00";
	}
	if ($('#input_secondto').val() != "" && isNaN($('#input_secondto').val())== false){
		l_to += ":"+$('#input_secondto').val();	
	}else{
		l_to += ":00";
	}
	
	m_fromdate = m_fromdate+" "+l_from;
	m_todate = m_todate+" "+l_to;
	if (m_fromdate!==""){
		$('body').css('cursor',"wait");
		$.ajax({url:"ajax_recognize_create.php", data: $("#recognizeform").serialize() , success:function(result){
			$('body').css('cursor',"auto");
			var expr = new RegExp('>[ \t\r\n\v\f]*<', 'g');
			var response_html_fixed = result.replace(expr, '><');
			$('body').css('cursor','auto');
			$("#tablebody tr").remove();
			$("#tablebody tbody").html(response_html_fixed);
			ScrollTable();
		}});
	}
}

function OnUpdate(){
	var winHf = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
	temp = $("#divscroll").position();
	var winH = parseInt(winHf - temp.top - 15);
	$("#winH").val(winH);
	var m_fromdate = $('#inputfrom').val();
	var l_from = "";
	if ($('#input_hourfrom').val() != "" && isNaN($('#input_hourfrom').val())== false){
		l_from = $('#input_hourfrom').val();
	}else{
		l_from = "00";
	}
	if ($('#input_munitefrom').val() != "" && isNaN($('#input_munitefrom').val())== false){
		l_from += ":"+$('#input_munitefrom').val();	
	}else{
		l_from += ":00";
	}
	if ($('#input_secondfrom').val() != "" && isNaN($('#input_secondfrom').val())== false){
		l_from += ":"+$('#input_secondfrom').val();	
	}else{
		l_from += ":00";
	}
	var m_todate = $('#inputto').val();
	var l_to = "";
	if ($('#input_hourto').val() != "" && isNaN($('#input_hourto').val())== false){
		l_to = $('#input_hourto').val();
	}else{
		l_to = "00";
	}
	if ($('#input_muniteto').val() != "" && isNaN($('#input_muniteto').val())== false){
		l_to += ":"+$('#input_muniteto').val();	
	}else{
		l_to += ":00";
	}
	if ($('#input_secondto').val() != "" && isNaN($('#input_secondto').val())== false){
		l_to += ":"+$('#input_secondto').val();	
	}else{
		l_to += ":00";
	}
	
	m_fromdate = m_fromdate+" "+l_from;
	m_todate = m_todate+" "+l_to;
	if (m_fromdate!==""){
		$('body').css('cursor',"wait");
		$.ajax({url:"ajax_recognize_update.php", data: $("#recognizeform").serialize() , success:function(result){
			$('body').css('cursor',"auto");
			OnReset();
			
			var expr = new RegExp('>[ \t\r\n\v\f]*<', 'g');
			var response_html_fixed = result.replace(expr, '><');
			$('body').css('cursor','auto');
			$("#tablebody tr").remove();
			$("#tablebody tbody").html(response_html_fixed);
			ScrollTable();
			
		}});
	}
}

function OnDisable(){
	$('#inputfrom').attr('disabled', 'disabled');
	$('#input_hourfrom').attr('disabled', 'disabled');
	$('#input_munitefrom').attr('disabled', 'disabled');
	$('#input_secondfrom').attr('disabled', 'disabled');
	$('#input_hourto').attr('disabled', 'disabled');
	$('#input_muniteto').attr('disabled', 'disabled');
	$('#input_secondto').attr('disabled', 'disabled');
	$('#re_camera').attr('disabled', 'disabled');
	$('#re_monitor').attr('disabled', 'disabled');
}

function OnEable(){
	$('#inputfrom').removeAttr('disabled');
	$('#input_hourfrom').removeAttr('disabled');
	$('#input_munitefrom').removeAttr('disabled');
	$('#input_secondfrom').removeAttr('disabled');
	$('#input_hourto').removeAttr('disabled');
	$('#input_muniteto').removeAttr('disabled');
	$('#input_secondto').removeAttr('disabled');
	$('#re_camera').removeAttr('disabled');
	$('#re_monitor').removeAttr('disabled');
}

function OnSelect(fromdate,todate,cameraid,total,unrecognize,recognize_fail,recognize_ok){
	//inputfrom input_hourfrom input_munitefrom input_secondfrom
	$("#inputfrom").val(fromdate.split(" ")[0]);
	var lastDate = fromdate.split(" ")[1];
	$("#input_hourfrom").val(lastDate.split(":")[0]);
	$("#input_munitefrom").val(lastDate.split(":")[1]);
	$("#input_secondfrom").val(lastDate.split(":")[2]);

	$("#inputto").val(todate.split(" ")[0]);$('#inputto').attr('disabled', 'disabled');
	lastDate = todate.split(" ")[1];
	$("#input_hourto").val(lastDate.split(":")[0]);
	$("#input_muniteto").val(lastDate.split(":")[1]);
	$("#input_secondto").val(lastDate.split(":")[2]);
	
	$("#re_camera option:selected").removeAttr("selected");
	$("#re_camera option").each(function(){
		if($(this).val()==cameraid){
			$(this).attr("selected",true);
		}
	});
	OnDisable();
	$("#re_total").val(total);
	$("#re_unrecognize").val(unrecognize);
	$("#re_fail").val(recognize_fail);
	$("#re_ok").val(recognize_ok);
	$("#re_ok_h").val(recognize_fail+recognize_ok);

	$("#re_fromid").val(fromdate);
	$("#re_toid").val(todate);
	$("#re_caid").val(cameraid);

	$("#re_save").hide();
	$("#re_update").show();
}

function OnReset(){
	$("#re_update").hide();
	$("#re_save").show();
	$("#re_monitor option:selected").removeAttr("selected");
	$("#re_monitor option:eq(0)").attr("selected",true);
	$("#re_camera option:selected").removeAttr("selected");
	$("#re_camera option:eq(0)").attr("selected",true);
	$("#re_total").val('');
	$("#re_unrecognize").val('');
	$("#re_fail").val('');
	$("#re_ok").val('');
	$("#re_ok_h").val("");
	OnChangeCamera();
	OnEable();
}

function OnRecognizeSort(ele){
	var winHf = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
	temp = $("#divscroll").position();
	var winH = parseInt(winHf - temp.top - 15);
	flag = $(ele).attr('values');
	
	if(flag=='20'){
		$(ele).attr('values','21');
	}else if(flag=='21'){
		$(ele).attr('values','20');
	}
	else if(flag=='30'){
		$(ele).attr('values','31');
	}else if(flag=='31'){
		$(ele).attr('values','30');
	}
	else if(flag=='40'){
		$(ele).attr('values','41');
	}else if(flag=='41'){
		$(ele).attr('values','40');
	}
	else if(flag=='50'){
		$(ele).attr('values','51');
	}else if(flag=='51'){
		$(ele).attr('values','50');
	}
	else if(flag=='60'){
		$(ele).attr('values','61');
	}else if(flag=='61'){
		$(ele).attr('values','60');
	}
	else if(flag=='70'){
		$(ele).attr('values','71');
	}else if(flag=='71'){
		$(ele).attr('values','70');
	}
	
	$.ajax({url:"ajax_recognizesort.php", data:{winH:winH,flag:flag} , success:function(result){
		var expr = new RegExp('>[ \t\r\n\v\f]*<', 'g');
		var response_html_fixed = result.replace(expr, '><');
		$("#tablebody tr").remove();
		$("#tablebody tbody").append(response_html_fixed);
		ScrollTable();
	}});
	
}

function OnSearchAll(){//s_monitor
	if($("#selectall").is(':checked')){
		$("#s_monitor").attr('disabled','disabled');
	}else{
		$("#s_monitor").removeAttr('disabled');
	}
}

function OnChangeMonitor(){
	$.ajax({url:"ajax_recognize_changemonitor.php", data:$("#recognizeform").serialize() , success:function(result){
		$("#re_camera").empty();
		$("#re_camera").append(result);
		OnChangeCamera();
	}});
}

function OnChangeCamera(){
	$.ajax({url:"ajax_recognize_changecamera.php", data:$("#recognizeform").serialize() , success:function(result){
		$("#re_total").val($(result).find("#total").val());
		$("#re_unrecognize").val($(result).find("#isNoReg").val());
		$("#re_ok").val($(result).find("#isReg").val());
		$("#re_ok_h").val($(result).find("#isReg").val());
		$("#re_fail").val(0);
	}});
}

function OnChangeFail(){
	if($("#re_fail").val()!=""){
		var fail = $("#re_fail").val();
		var ok = $("#re_ok_h").val();
		if(parseInt(fail)<=parseInt(ok)){
			$("#re_ok").val(ok-fail);
		}
	}else{
		$("#re_fail").val(0);
		$("#re_ok").val($("#re_ok_h").val());
	}
}


function OnPagging(pageNum,rows_per_page,number_of_page){
	
	$.ajax({url:"ajax_cameraspagging.php", data:{ pageNum:pageNum,rows_per_page:rows_per_page,number_of_page:number_of_page } , success:function(result){
		$("#tablebody tr").remove();
		$("#tablebody tbody").append(result);
		ScrollTable();
		
	}});
	$.ajax({url:"ajax_cameraspaggingfooter.php", data:{ pageNum:pageNum,rows_per_page:rows_per_page,number_of_page:number_of_page } , success:function(result){
		$("#tablefooter tr").remove();
		$("#tablefooter tbody").append(result);

		$("table#tableheader th[name='th1']").attr('onclick',"OnCamerasSort(this,"+pageNum+","+rows_per_page+")");
		$("table#tableheader th[name='th2']").attr('onclick',"OnCamerasSort(this,"+pageNum+","+rows_per_page+")");
		$("table#tableheader th[name='th3']").attr('onclick',"OnCamerasSort(this,"+pageNum+","+rows_per_page+")");
		$("table#tableheader th[name='th4']").attr('onclick',"OnCamerasSort(this,"+pageNum+","+rows_per_page+")");
		$("table#tableheader th[name='th5']").attr('onclick',"OnCamerasSort(this,"+pageNum+","+rows_per_page+")");
		$("table#tableheader th[name='th6']").attr('onclick',"OnCamerasSort(this,"+pageNum+","+rows_per_page+")");
		
	}});
	
	
}

function OpenView(ele,monitorid,carmeraid,todate,fromdate){
	var monitorname = '<?=$_REQUEST['monitorname']?>';
	$('#tablebody tr.select').removeClass('select');
	$(ele).parent().parent().addClass('select');
	var w = parseInt(window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth)-100;
	window.open("carnumsview.php?monitorid="+monitorid+"&carmeraid="+carmeraid+"&fromdate="+fromdate+"&todate="+todate+"&monitorname="+monitorname,'','width='+w+',scrollbars=1,location=1,titlebar=1,resizable=1,toolbar=1');

}

function loadpos(){
	var winHf = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
	temp = $("#divscroll").position();
	$("#divscroll").css("height",parseInt(winHf - temp.top - 15));
}

</script>

</head>
<?php include 'show_function_popup_carcrime.php';?>
<body onresize="MyResize()"  onload="loadpos();OnChangeCamera();load_popup_carCrime();">
<p id="maylya" ><input type="hidden"  id="mayly" name="mayly" /></p>
<?php 
$monitor = $_REQUEST['monitor'];
$monitorname=$_REQUEST['monitorname'];
if (isset($_SESSION['monitor_menu'])) {
	$monitor = $_SESSION['monitor_menu'];
}
?>  
    <?php include 'menu.php';?>
    <div id="submenu">
    	<ul class="asubmenu">
    		<li><a href="searchcarnums.php?monitor=<?=$monitor?>&monitorname=<?=$monitorname?>" class="asubmenuselect"><?=$l_recognitionrate?></a></li>
        	<li><a href="carnums.php?monitor=<?=$monitor?>&monitorname=<?=$monitorname?>"><?=$l_s_canums?></a></li>
            <li><a href="trace.php?monitor=<?=$monitor?>&monitorname=<?=$monitorname?>" ><?=$l_s_trace?></a></li>
            <li><a href="cameras.php?monitor=<?=$monitor?>&monitorname=<?=$monitorname?>"><?=$l_camera?></a></li>
            <li><a href="searchs.php?monitor=<?=$monitor?>&monitorname=<?=$monitorname?>" ><?=$l_s_searchs?></a></li>
            <li><a href="alarms.php?monitor=<?=$monitor?>&monitorname=<?=$monitorname?>" ><?=$l_s_alarms?></a></li>
            <li><a href="users.php?monitor=<?=$monitor?>&monitorname=<?=$monitorname?>" ><?=$l_s_users?></a></li>
        </ul>
        <div class="clear"></div>
    </div>
    <div class="main" style="clear:both">
    	<div style="height:10px;"></div>
    	<div>
    		<div style="width:29%;float:left">
    			<form action="" id="recognizeform">
    				<table class="tbm1" >
    					<tr>
    						<td width="100px" style="padding-top: 0 !important"><?=$l_from?></td>
    						<td colspan="2" style="padding-top: 0 !important">
	    						<input type="text" class="intext" readonly="readonly" name="inputfrom" id="inputfrom" value="<?=$searchdate?>" style="width:100px;height: 20px;vertical-align: top"/>
					    		<span style="padding-left: 10px;"><input type="text" class="intext"  style="width:20px;height: 20px" name="input_hourfrom" id="input_hourfrom" size="2"  value="00" /></span>
								<span style="padding-left: 10px;"><input type="text" class="intext"  style="width:20px;height: 20px" name="input_munitefrom" id="input_munitefrom"  size="2" maxlength="2"  value="00" /></span>
								<span style="padding-left: 10px;"><input type="text" class="intext"  style="width:20px;height: 20px" name="input_secondfrom" id="input_secondfrom"  size="2" maxlength="2" value="00" /></span></td>
    					</tr>
    					<tr>
    						<td><?=$l_to?></td>
    						<td colspan="2">
    							<input type="text"  class="intext" readonly="readonly" name="inputto"  id="inputto" value="<?=$searchdate?>" style="width:100px;height: 20px;vertical-align: top"/>
					    		<span style="padding-left: 10px;"><input type="text" class="intext"  style="width:20px;height: 20px" name="input_hourto" id="input_hourto"  size="2" maxlength="2"  value="23" "/></span>
								<span style="padding-left: 10px;"><input type="text" class="intext"  style="width:20px;height: 20px" name="input_muniteto" id="input_muniteto"  size="2" maxlength="2"  value="59" /></span>	
					    		<span style="padding-left: 10px;"><input type="text" class="intext"  style="width:20px;height: 20px" name="input_secondto" id="input_secondto"  size="2" maxlength="2"  value="59" /></span>
    						</td>
    					</tr>
    					<tr>
    						<td><?=$l_monitor?></td>
    						<td>
    							<select class="seltop" style="width:178px" name="re_monitor" id="re_monitor" onchange="OnChangeMonitor()" >
    								<option value="0" selected="selected"><?=$l_s_all?></option>
    								<?php 
					    			$monitors = array();
					    			while ($row = mysql_fetch_array($listMonitor)){
					    				$monitors[$row['Monitor_ID']]= $row['Name'];
									 ?>
									 <option value="<?=$row['Monitor_ID']?>"><?=$row['Name']?></option>
									 <?php  }?> 
    							</select>
    						</td>
    						<td></td>
    					</tr>
    					<tr>
    						<td><?=$l_camera?></td>
    						<td>
    							<select class="seltop" style="width:178px" name="re_camera" id="re_camera" onchange="OnChangeCamera()">
		                		 	<?php 
					    			while ($row_c = mysql_fetch_array($selectallcamenra)){
									 ?>
									 <option value="<?=$row_c['id']?>"><?=$row_c['name']?></option>
									 <?php  }?> 
    							</select>
    						</td>
    						<td></td>
    					</tr>
    					<tr>
    						<td><?=$l_re_tong?></td>
    						<td><input type="text" style="background-color: #c6c6c6" readonly="readonly"  class="intext"  name="re_total" id="re_total" /></td>
    						<td><input type="hidden" name="winH" id="winH" value="500"/></td>
    					</tr>
    					<tr>
    						<td><?=$l_re_unrecognize?></td>
    						<td><input type="text" style="background-color: #c6c6c6" readonly="readonly"   class="intext" name="re_unrecognize" id="re_unrecognize" /></td>
    						<td></td>
    					</tr>
    					<tr>
    						<td><?=$l_fail?></td>
    						<td><input type="text"  class="intext" name="re_fail" id="re_fail" onkeypress="validateNumber(event,this)" onkeyup="OnChangeFail()" /></td>
    						<td align="right">
    						<input class="inbtn" onclick="OnReset()" type="button" value="<?=$l_reset?>" />
    						<input type="hidden" name="re_fromid" id="re_fromid" value=""/>
    						<input type="hidden" name="re_toid" id="re_toid" value=""/>
    						<input type="hidden" name="re_caid" id="re_caid" value=""/>
    						</td>
    					</tr>
    					<tr>
    						<td><?=$l_re_ok?></td>
    						<td><input type="text" style="background-color: #c6c6c6" readonly="readonly"  class="intext" name="re_ok" id="re_ok" />
    						<input type="hidden" class="intext" name="re_ok_h" id="re_ok_h" />
    						</td>
    						<td align="right">
    							<input class="inbtn" type="button" id="re_save" name="re_save" value="<?=$l_save?>" onclick="OnSave()"/>
    							<input class="inbtn" type="button" value="Update" id="re_update" style="display:none" value="<?=$l_update?>"  name="re_update"  onclick="OnUpdate()"/>
    							<input type="hidden" name="re_user" value="<?=$_SESSION['iduser']?>"/>
    						</td>
    					</tr>
    				</table>
    			</form>
    		</div>
    		<div style="width:70%;float:left">
    			<div style="width:100%;text-align: center;min-width:624px;" >
					<input type="checkbox" id="selectall" onclick="OnSearchAll()"/><label style="color:#ffffff">&nbsp;<?=$l_s_all?>&nbsp;&nbsp;</label>
			    		<select style="width: 150px;height: 20px;vertical-align: top" id="s_monitor">
			    			<?php 
			    			foreach ($monitors as $key_m => $val_m){
							 ?>
							 <option value="<?=$key_m?>"><?=$val_m?></option>
							 <?php  }?>  
			    		</select>
					
					
					<label></label>
		    		<span style="color: white;padding-left: 20px;"><?php echo $l_from?></span>
		    		<input type="text" class="intext"  id="datepickerfrom" value="<?=$searchdate?>" style="width:100px;height: 20px;vertical-align: top"/>
		    		
		    		<span style="padding-left: 10px;"><input type="text" class="intext"  style="width:20px;height: 20px" name="s_hourfrom" id="s_hourfrom" size="2"  value="00" /></span>
					<span style="padding-left: 10px;"><input type="text" class="intext"  style="width:20px;height: 20px" name="s_munitefrom" id="s_munitefrom"  size="2" maxlength="2"  value="00" /></span>
					<span style="padding-left: 10px;"><input type="text" class="intext"  style="width:20px;height: 20px" name="s_secondfrom" id="s_secondfrom"  size="2" maxlength="2" value="00" /></span>
					<span style="color: white;padding-left: 20px;"><?php echo $l_to?></span>
					<input type="text"  class="intext"  id="datepickerto" value="<?=$searchdate?>" style="width:100px;height: 20px;vertical-align: top"/>
					
		    		<span style="padding-left: 10px;"><input type="text" class="intext"  style="width:20px;height: 20px" name="s_hourto" id="s_hourto"  size="2" maxlength="2"  value="23" "/></span>
					<span style="padding-left: 10px;"><input type="text" class="intext"  style="width:20px;height: 20px" name="s_muniteto" id="s_muniteto"  size="2" maxlength="2"  value="59" /></span>	
		    		<span style="padding-left: 10px;"><input type="text" class="intext"  style="width:20px;height: 20px" name="s_secondto" id="s_secondto"  size="2" maxlength="2"  value="59" /></span>
		           	<span  style="padding-left: 15px;"><input type="button" class="inbtn" style="height: 23px" value="<?=$l_search?>" onclick="OnSearch()" /></span>
		    	</div>
    			<div class="divtheader" style="margin-top: 15px">
			    	<table  cellpadding="0" cellspacing="0" border="0" width="100%" class="tbchung" id="tableheader" style="border:none;margin-top:0; min-height: 20px">
			               <tr>
			                   <th width="6%" name="th1" ><?=$l_so?></th> 
			                   <th width="44%" name="th2" style="cursor: pointer;color: #027acc"  onclick="OnRecognizeSort(this)" values="20"><?=$l_cameraname?></th>
			                   <th width="10%" name="th3" style="cursor: pointer;color: #027acc"  onclick="OnRecognizeSort(this)" values="30"><?=$l_re_tong?></th>
			                   <th width="10%" name="th4" style="cursor: pointer;color: #027acc"  onclick="OnRecognizeSort(this)" values="40"><?=$l_re_unrecognize?></th> 
			                   <th width="10%" name="th5" style="cursor: pointer;color: #027acc" onclick="OnRecognizeSort(this)" values="50"><?=$l_fail ?></th>
			                   <th width="10%" name="th5" style="cursor: pointer;color: #027acc" onclick="OnRecognizeSort(this)" values="60"><?=$l_re_ok?></th>
			                   <th width="10%" class="last" name="th6" style="cursor: pointer;color: #027acc" onclick="OnRecognizeSort(this)" values="70"><?=$l_c_percent?></th> 
			               </tr>
			        </table>
		        </div>
		        <div id="mycontent">
			        <div  id="divscroll"  style="overflow:scroll;overflow-x:hidden; width:100%; height:490px; background-color: #ffffff" >
			               <table  cellpadding="0" cellspacing="0" border="0" width="100%" class="tbchung" style="margin-top:0" id="tablebody">
								<tbody> 
									
			      				</tbody>
			               </table>
			       </div>
			   </div>
    		</div>
    	</div>
    	
       <!--div style="width:100%; padding:10 0">
       		<label>ëª¨ë‘� ë³´ê¸° &nbsp&nbsp</label>
       		<label style="width:1.5px; height: 30px;color: #ffffff; background-color: #ffffff">|</label>
       		<label>&nbsp adfasdfadf</label>
       </div>
       <div style="width:100%; padding:10 0; background-color: #ffffff">
       
       </div-->
              
    </div>
    <?php include 'show_content_popup_carcrime.php';?>
    <?php mysql_close($connection);?>
</body>     
</html>